package so.sao.code.service.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import so.sao.code.service.domain.entity.EnterpriseCustomField;

@Repository
public interface EnterpriseCustomFieldDao extends JpaRepository<EnterpriseCustomField, Long>  {
	List<EnterpriseCustomField> findByEseId(Long eseId);
	
	List<EnterpriseCustomField>  findByfieldKey(String fieldKey);
	
	EnterpriseCustomField findByfieldKeyAndEseId(String str, Long eseId);
	@Query(value = "select * from enterprise_custom_field  where id  in (select max(id) from enterprise_custom_field group by field_key)", nativeQuery = true)
	List<EnterpriseCustomField> findDistinctAll();
	
	List<EnterpriseCustomField>  findByfieldName(String str);
	
	void deleteByfieldKey(String fieldKey);

}
